import Vue from 'vue'
import Router from 'vue-router'
import Home from './components/Home'
import Admin from './components/Admin'
import Menu from './components/Menu'
import About from './components/about/About'
import Login from './components/Login'
import Register from './components/Register'

//二级路由
import Contact from './components/about/Contact'
import Delivery from './components/about/Delivery'
import History from './components/about/History'
import OrderingGuide from './components/about/OrderingGuide'

//三级路由

import PersonName from './components/about/contact/PersonName'
import Phone from './components/about/contact/Phone'



Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home 
    },
    {
      path:'/Menu',
      name:'menuLink',
      component:Menu
    },
    {
      path:'/About',
      name:'aboutLink',
      redirect:'/history',
      component:About,children:[
        {path:'/about/contact',name:'contactLink',component:Contact,redirect:'/phone', children:[
          {path:'/phone',name:'phone',component:Phone},
          {path:'/personname',name:'personName',component:PersonName},

        ]},
        {path:'/history',name:'historyLink',component:History},
        {path:'/delivery',name:'deliveryLink',component:Delivery},
        {path:'/orderingGuide',name:'orderingGuideLink',component:OrderingGuide},
      ]
    },    {
      path:'/Admin',
      name:'adminLink',
      component:Admin
    },    {
      path:'/Register',
      name:'registerLink',
      component:Register
    },
    {
      path:'/Login',
      name:'loginLink',
      component:Login
    },
    {
      path:'*',
      redirect:'/'
    }, 
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
    },
    {
      path:'/liqiliqi',
    },
    {
      path:'/mmmmm',
    }
  ]
})

  
//全局守卫    to:进入到哪个路由  from：从哪个路由离开  next对应的函数
